import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class jdbcdemo4_Statement {

    public void testDMl() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        /*本机MySQL并且端口3306可以简化书写
        String url = "jdbc:mysql://cc";
         */
        String url = "jdbc:mysql://192.168.2.131:3306/cc";
        String username = "root";
        String password = "abc123";
        Connection conn = DriverManager.getConnection(url,username,password);

        String sql = "update account set money = 3000 where id = 1";
        Statement stmt = conn.createStatement();
        int count = stmt.executeUpdate(sql);

        //System.out.println(count);

        if (count > 0){
            System.out.println("修改成功~");
        }else{
            System.out.println("修改失败~");
        }

        stmt.close();
        conn.close();
        System.out.println("==============");


    }







}

